package com.yueka.controller;

import com.yueka.pojo.Result;
import com.yueka.pojo.role.Role;
import com.yueka.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/role")
@RestController
public class RoleController {

    @Autowired
    private RoleService roleService;

    @GetMapping("/list")
    public Result list(String keyword, Integer page, Integer pageSize){
        return Result.success(roleService.list(keyword, page, pageSize));
    }

    @GetMapping("/delete")
    public Result delete(Integer[] ids){
        return Result.success(roleService.delete(ids));
    }
    @GetMapping("/getAll")
    public Result getAll(){
        return Result.success(roleService.getAll());
    }

    @PostMapping("/update")
    public Result update(@RequestBody Role role){
        return Result.success(roleService.update(role));
    }
}
